package com.ruoyi.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author： yu.Tan
 * @Date: 2020/8/20 11:02
 * @Description:
 */
@Configuration
public class DirectRabbitConfig {

    //队列
    @Bean
    public Queue DirectQueue() {
        return new Queue("DirectQueue-1027-1",true);
    }

    //Direct交换机
    @Bean
    DirectExchange DirectExchange() {
        return new DirectExchange("DirectExchange-1027");
    }

    //绑定
    @Bean
    Binding bindingDirect() {
        return BindingBuilder.bind(DirectQueue()).to(DirectExchange()).with("DirectRouting");
    }
}
